<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<style>
.form-item {
	margin: 20px 10px;
}

.form-item>label {
	letter-spacing: 3px;
	width: 116px;
	text-align: right;
	display: inline-block;
}

.form-item>label:AFTER {
	content: ":";
}

.form-item input[type=text] {
	width: 100px;
}

.form-item.required>label:BEFORE {
	content: "*";
	color: red;
}
</style>
<script>
	function GetValue(obj) {
		var id = obj;
		var optionString = "<option grade=\'请选择阶段名称\' selected = \'selected\'>--请选择阶段名称--</option>";
		$
				.get(
						"jiaoxue/neirong/" + id,
						function(rs) {
							if (rs.success) {
								var data = rs.message;
								for (var i = 0; i < data.length; i++) {
									optionString += "<option value=\""+data[i].chapterName+"\"";  
                      optionString += ">"
											+ data[i].chapterName + "</option>"; //动态添加数据  
								}
								$("select[id=chapter]").empty();
								$("select[id=chapter]").append(optionString);
							} else {
								$.message.alert("提示错误！")
							}
						});
	}

	//isAll 是否全部移动  
	function left(isAll) {
		var os = new Array();
		os = $("#right_select").find("option");
		for (i = 0; i < os.length; i++) {
			if (isAll) {
				var o = new Option(os[i].text, os[i].value);
				$("#left_select").append(o);
				$("#right_select").find("option").remove();
				// == $("#right_select").empty();  
			} else {
				if (os[i].selected) {
					var o = new Option(os[i].text, os[i].value);
					$("#left_select").append(o);
					$("#right_select").find("option:selected").remove();
				}
			}
		}
	}
	function right(isAll) {
		var os = new Array();
		os = $("#left_select").find("option");
		for (i = 0; i < os.length; i++) {
			if (isAll) {
				var o = new Option(os[i].text, os[i].value);
				$("#right_select").append(o);
				$("#left_select").find("option").remove();
				// == $("#left_select").empty();  
			} else {
				if (os[i].selected) {
					var o = new Option(os[i].text, os[i].value,os[i].selected);
					$("#right_select").append(o);
					var str = $("#right_select option").map(function(){return $(this).val();}).get().join(", ")
			        alert(str);
					$("#gray").val(str);
					$("#left_select").find("option:selected").remove();
				}
			}
		}
	}
	function move(obj) {
		var id=obj;
		 var optionString = "";
		 $.get("jiaoxue/teamcontent/" + id, function(rs) {
				if (rs.success) {
					var data=rs.message;
					for (var i = 0; i < data.length; i++) {
						 optionString +="<option grade=\""+data[i].stuId+"\" value=\""+data[i].stuId+"\"";  
	                      optionString += ">"+data[i].studentName+"</option>";  //动态添加数据  
					}
					 $("select[id=zuZhangId]").empty();
					 $("select[id=zuZhangId]").append(optionString);
				}else{
					$.message.alert("提示错误！")
				}
			});
	}
</script>
<form id="buZhiForm">
	<input type="hidden" name="zuoyeId" value="${zuoye.zuoyeId }">
	<input type="hidden" name="userinfo" value="${userinfo.userInfoId }">
	<h3 style="text-align: center; margin-top: 15px;">布置作业</h3>
	<div class="form-item required">
		<label for="">试卷/练习名称</label> <input type="text"
			value="${zuoye.zuoyeName }" name="zuoyeName" data-options="required:true"
			class="easyui-textbox"> <label for="">出卷人</label> <input
			type="text" value="${userinfo.userName }" name="user"  readonly="readonly"
			data-options="required:true" class="easyui-textbox">
	</div>
	<div class="form-item required">
		<label for="">所属阶段</label> <select id="phase" name="phase"
			style="height: 24px; border-radius: 5px; border-color: dodgerblue;"
			onchange="GetValue(this.value)">
			<c:forEach items="${phase }" var="x">
				<option value="${x.phaseId }"
					${phaseB.phaseId==x.phaseId?'selected':'' }>${x.phaseName }</option>
			</c:forEach>
		</select> <label style="margin-left: 15px;" for="">所属章节</label> <select
			id="chapter" name="chapter"
			style="height: 24px; border-radius: 5px; border-color: dodgerblue;">
			<c:forEach items="${chapter }" var="x">
				<option value="${x.chapterName }"
					${chapterA.chapterName==x.chapterName?'selected':'' }>${x.chapterName }</option>
			</c:forEach>
		</select>
	</div>
	<div class="form-item required">
		<label style="width: 250px;">类型:指定类型，考试试卷或练习</label><br />
		<br />
		<div style="margin-left: 100px;">
		<label>
			<input type="radio" ${zuoye.type == '考试'?'checked':'' } name="type" value="考试" /> 考试
		</label>
		<label>
			<input type="radio" ${empty zuoye || zuoye.type == '练习'?'checked':'' } name="type" value="练习" /> 练习
		</label>
		</div>
	</div>
	<div class="form-item required">
		<label for="">有效时间</label>
		 <input class="easyui-datetimebox" data-options="required:true"  name="buzhiTime" ${empty zuoye.buzhiTime ?'':'readOnly="readOnly" ' }  value="${zuoye.buzhiTime }" style="width: 150px">&nbsp;&nbsp;~&nbsp;&nbsp;
		 <input class="easyui-datetimebox" data-options="required:true"  value="${zuoye.endTime }" name="endTime" style="width: 150px">
	</div>
	<div class="form-item">
		<label for="">考试时间</label> <select name="youXiaoTime" style="height:24px;border-radius: 5px;border-color: dodgerblue;" >
			<option value="">请选择</option>
			<option value="半小时" ${zuoye.youXiaoTime=='半小时'?'selected':'' }>半小时</option>
			<option value="一小时" ${zuoye.youXiaoTime=='一小时'?'selected':'' }>一小时</option>
			<option value="一小时半" ${zuoye.youXiaoTime=='一小时半'?'selected':'' }>一小时半</option>
			<option value="两小时" ${zuoye.youXiaoTime=='两小时'?'selected':'' }>两小时</option>
			<option value="两小时半" ${zuoye.youXiaoTime=='两小时半'?'selected':'' }>两小时半</option>
			<option value="三小时" ${zuoye.youXiaoTime=='三小时'?'selected':'' }>三小时</option>
			<option value="三小时半" ${zuoye.youXiaoTime=='三小时半'?'selected':'' }>三小时半</option>
		</select> <label style="margin-left: 25px;" for="">选择题数量</label> <input
			type="text" value="${x }"  data-options="required:true"   name="optionCount" class="easyui-textbox">
	</div>
	<div class="form-item">
		<label for="">判断题数量</label> <input type="text"  data-options="required:true"   name="panDuanCount" value="${y }"
			class="easyui-textbox"> <label for="">编码题数量</label> <input
			type="text" value="${z }"  data-options="required:true"   name="daiMaCount" class="easyui-textbox">
	</div>
	<c:if test="${empty zuoye.zuoyeId }">
	<div class="form-item required">
		<label style="width: 120px;" for="">给班级布置作业</label><br />
		<table cellspacing="1" width="350px" align="center"
			style="margin-left: 20px;">
			<tr>
				<td>
					<table style="background-color: white" width="100%">
						<tr>
							<td>
								<fieldset>
									<legend style="text-align: center;">所有的班级</legend>
									<select name="left_select" multiple="multiple" size="8"
										id="left_select"
										style="width: 230px; border: 0px; padding: 3px;">
										<c:forEach items="${classList }" var="v">
											<option value="${v.classId }">${v.className }</option>
										</c:forEach>
									</select>
								</fieldset>
							</td>
							<td></td>
							<td>
							<input type="button" value="<" style="
								font-size:10pt;width:35px" onclick="left()"><br><input
								type="button" value="<<" style="
								font-size:10pt;width:35px;margin-top:10px;" onclick="left(true)"><br>
								<input type="button" value=">"
								style="font-size: 10pt; width: 35px;margin-top:10px;" onclick="right()"><br>
								<input type="button" value=">>"
								style="font-size: 10pt; width: 35px;margin-top:10px;" onclick="right(true)"><br>
							</td>
							<td></td>
							<td>
								<fieldset>
									<legend style="text-align: center;">选定的班级</legend>
									<select name="right_select" multiple="multiple"
										style="width: 230px; border: 0px; padding: 3px;" size="8"
										id="right_select">
										<c:forEach items="${AllClass }" var="g">
										<option value="${g.classId }"  selected="selected">${g.className }</option>
										</c:forEach>
									</select>
									<input type="hidden" name="selectedClass" id="gray">
								</fieldset>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</div>
	</c:if>
	<div class="form-item">
		<label for="">说明/备注</label><br />
		<textarea name="addPlus" style="width: 350px; height: 100px; margin-left: 120px;">${zuoye.addPlus }</textarea>
	</div>
</form>